package com.spring.boot.demo.controller;

import com.spring.boot.demo.anno.LogRecord;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZhuYouBin
 * @version 1.0.0
 * @Date: 2022/11/2 22:58
 * @Description
 */
@RestController
@RequestMapping("/api/aop")
public class LogController {

    @LogRecord(opName = "测试日志", desc = "测试日志描述内容")
    @GetMapping("/log")
    public String demo() {
        System.out.println("开始执行业务逻辑代码......");
        return "success.";
    }

    @LogRecord(opName = "测试日志", desc = "测试日志描述内容")
    @GetMapping("/error")
    public String error() {
        System.out.println("开始执行业务逻辑代码......");
        int i = 10 / 0;
        return "success.";
    }

}
